Crate factory

Source
Expand description

This crate provides Factory trait and its implementations.

The trait makes it possible to create any number of instances of a specific type.

§Examples

Creates default instances of u8 type:

use factory::{DefaultFactory, Factory};

let f = DefaultFactory::<u8>::new();
assert_eq!(f.create(), 0);
assert_eq!(f.create(), 0);

Structs§

  • A Factory that creates instances using T::clone() method.
  • A Factory that creates instances using T::default() function.
  • #[cfg(feature = "swappable")] A Factory that allows for swapping inner factories dynamically.

Traits§

  • This trait allows for creating any number of instances of the Item type.
  • This trait allows for creating any number of instances of the Item type with the given parameter.